package com.baomidou.ant.service.impl;

import com.baomidou.ant.entity.ApplyFamilyInfo;
import com.baomidou.ant.entity.ApplyInternshipInfo;
import com.baomidou.ant.mapper.ApplyFamilyInfoMapper;
import com.baomidou.ant.service.IApplyFamilyInfoService;
import com.baomidou.ant.vo.request.RequestFamilyInfoVo;
import com.baomidou.ant.vo.request.RequestInternshipInfoVo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jobob
 * @since 2022-09-20
 */
@Service
public class ApplyFamilyInfoServiceImpl extends ServiceImpl<ApplyFamilyInfoMapper, ApplyFamilyInfo> implements IApplyFamilyInfoService {

    @Override
    public List<RequestFamilyInfoVo> queryByAId(Integer aid) {
        List<RequestFamilyInfoVo> voList=new ArrayList<>();
        QueryWrapper<ApplyFamilyInfo> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("apply_info_id",aid);
        List<ApplyFamilyInfo> applyFamilyInfoList=list(queryWrapper);
        for(ApplyFamilyInfo applyFamilyInfo:applyFamilyInfoList){
            RequestFamilyInfoVo vo=new RequestFamilyInfoVo();
            BeanUtils.copyProperties(applyFamilyInfo,vo);
            voList.add(vo);
        }
        return voList;
    }
}
